﻿using UnityEngine;
using System.Collections;
namespace FSM
{
    public class Condition:BehaviorNode
    {
        protected GameObject gameobject;
        private bool entered = false;
        public void Enter()
        {
            entered = true;
            OnEnter();
        }
        public virtual void Init(params object[] param)
        {
        }
        protected virtual void OnEnter()
        {
        }
        public bool Update()
        {
            if(enable)
            {
                /*if(!entered)
                {
                    Enter();
                }*/
                var b = OnUpdate();
                return b;
            }
            return false;
        }
        protected virtual bool OnUpdate()
        {
            return false;
        }
        public void Leave()
        {
            entered = false;
            OnLeave();
        }
        protected virtual void OnLeave()
        {
        }
    }
}

